Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor eotsd keys cmd #102

Merged
merged 5 commits into from
Oct 25, 2024
Merged

chore: refactor eotsd keys cmd #102

merged 5 commits into from
Oct 25, 2024

Conversation

gitferry
Copy link
Member

@gitferry gitferry commented Oct 22, 2024

Closes #63:

  • Replace eotsd cli library with cobra lib to be consistent with fpd
  • Remove export-pop and sign-schnorr because they are not needed for phase-2
  • Reuse keys commands from cosmos-sdk
  • Wrap keys add commands to save the public key and key name wrapping
  • Refactor eotsd cmd folder architect

Example after change:

❯ ./build/eotsd keys add "test-key-0" --keyring-backend=test

**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

topic expire slush beyond room cube train tenant dice negative winter lamp unaware winner story bounce space try rotate tiny assault grain scheme pact

name: test-key-0
pub_key_hex: e40ea1364293afd9d7400b58f336e7b6b10baf83ef31ef83b447f3fcdd928b59

@gitferry gitferry marked this pull request as ready for review October 22, 2024 15:13
Copy link

@KonradStaniec KonradStaniec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one question about this todo

// and exists a value in the config that could be used, it will be set in the ctx.
func PersistClientCtx(ctx client.Context) func(cmd *cobra.Command, _ []string) error {
return func(cmd *cobra.Command, _ []string) error {
// TODO(verify): if it uses the default encoding config it fails to list keys! output:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh do we have some test case for this ? or this is cosmos-sdk bug and we do not need to do anything with this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I copied it from

func PersistClientCtx(ctx client.Context) func(cmd *cobra.Command, _ []string) error {
. Any ideas? @RafilxTenfen

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah I remembered
I only create the whole app to get the configs to ctx

		tempApp := app.NewTmpBabylonApp()

		ctx = ctx.
			WithCodec(tempApp.AppCodec()).
			WithInterfaceRegistry(tempApp.InterfaceRegistry()).
			WithTxConfig(tempApp.TxConfig()).
			WithLegacyAmino(tempApp.LegacyAmino()).
			WithInput(os.Stdin)

If we use the appparams.DefaultEncodingConfig() instead of tempApp := app.NewTmpBabylonApp() it fails

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add std.RegisterInterfaces(encCfg.InterfaceRegistry). Otherwise, it does not how to decode the key. See the fix in 942df6e

@gitferry gitferry merged commit 5118dc5 into main Oct 25, 2024
12 checks passed
@gitferry gitferry deleted the chore/change-eotsd-cli branch October 25, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve eotsd key management
3 participants